import 'package:flutter/material.dart';
import 'package:flutterdemo/day02/01_statelesswidget.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // 启动要显示的界面
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("图标组件示例"),
      ),
      body: JKHomeContent(),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          print("FloatingActionButton Click");
        },
      ),
    );
  }
}

class JKHomeContent extends StatelessWidget {
  final imageUrl = 'https://tva1.sinaimg.cn/large/006y8mN6gy1g7aa03bmfpj3069069mx8.jpg';
  @override
  Widget build(BuildContext context) {
    // 1.占位图的使用
    // 2.图片缓存 1000张，100M，多了之后会清理一部分图片
    return FadeInImage(
      // 占位图淡出的时间
      fadeOutDuration: Duration(seconds: 1),
      // 网络图片显示的时间
      fadeInDuration: Duration(seconds: 1),
      placeholder: AssetImage("assets/images/placeholder_black.png"),
      image: NetworkImage(imageUrl),
    );
  }
}



